home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 2.iso / STUTTGART / FROMUTS / UNIXLIB37B / src / c / strstr < prev    next >
Text File  |  1992-02-14  |  593b  |  29 lines

  1. #ifdef __STDC__
  2. static char sccs_id[] = "@(#) strstr.c 1.1 "__DATE__" HJR";
  3. #else
  4. static char sccs_id[] = "@(#) strstr.c 1.1 26/9/90 HJR";
  5. #endif
  6.  
  7. /* strstr.c (c) Copyright 1990 H.Rogers */
  8.  
  9. #ifndef __STDC__
  10. #include "sys/types.h"
  11. #endif
  12. #include <string.h>
  13.  
  14. #ifdef __STDC__
  15. char *strstr(register const char *s1,register const char *s2)
  16. #else
  17. char *strstr(s1,s2)
  18. register const char *s1;
  19. register const char *s2;
  20. #endif
  21. {
  22. register int l1 = strlen(s1),l2 = strlen(s2);
  23. register const char *e1 = s1 + l1 - l2;
  24.  
  25. while (s1 < e1) { if (!strncmp(s1,s2,l2)) return((char *)s1); s1++; }
  26.  
  27. return(0);
  28. }
  29.